import { ProCard, ProColumns, ProTable } from "@ant-design/pro-components";

const App:React.FC=()=>{
     interface DataType{
        code?:string,name?:string,degree?:string,memo?:string,ddate?:string,quantity?:number,
        invstd?:string,munit_name?:string,dep_name?:string,operater_name?:string,status?:string,type?:string,
        life_circle?:number,life_now?:number,life_diff?:number,
     };

     const columns:ProColumns<DataType>[]=[
        {dataIndex:'code',title:'编码'},{dataIndex:'name',title:'名称'},{dataIndex:'degree',title:'等级'},
         {dataIndex:'invstd',title:'规格'},{dataIndex:'munit_name',title:'单位'},{dataIndex:'quantity',title:'数量'},
        {dataIndex:'type',title:'用途'},{dataIndex:'status',title:'校准结果'},
        {dataIndex:'life_circle',title:'总使用寿命量'},{dataIndex:'life_now',title:'本次寿命耗用量'},
        {dataIndex:'life_diff',title:'剩余寿命量',valueType:'progress',width:'20%'
            // render:(text,record,index,action)=>((record.life_circle==undefined?0:record.life_circle)
            //                                     -(record.life_now==undefined?0:record.life_now))
            //                                     /(record.life_circle==undefined?1:record.life_circle)*100,
        },
        {dataIndex:'dep_name',title:'部门'},{dataIndex:'operater_name',title:'校准人'},
        {dataIndex:'ddate',title:'校准日期',valueType:'date'},
        
     ];

     const tdata:DataType[]=[
        {code:'A00199',name:'XX水平仪',type:'仪器仪表',degree:'A级',invstd:'TC0012-3',munit_name:'只',life_circle:1000,life_now:200,
            quantity:2,dep_name:'研发中心',operater_name:'张小非',ddate:'2023-10-01',status:'合格',life_diff:80},
            {code:'CM66001',name:'XX精准尺度仪',type:'仪器仪表',degree:'A级',invstd:'FNK89263',munit_name:'只',life_circle:800,life_now:200,
                quantity:2,dep_name:'机加工车间',operater_name:'张小非',ddate:'2023-10-02',status:'合格',life_diff:75},
                {code:'A001',name:'XX刀具',type:'工装夹具',degree:'GA级',invstd:'TC0012-3',munit_name:'只',life_circle:1000,life_now:500,
                    quantity:5,dep_name:'机加工车间',operater_name:'吴军',ddate:'2023-10-03',status:'待判定',life_diff:60},
                    {code:'A001',name:'XXCXXX',type:'生产',degree:'工装夹具A级',invstd:'TC0012-3',munit_name:'只',life_circle:900,life_now:600,
                        quantity:1,dep_name:'喷漆车间',operater_name:'李卫卫',ddate:'2023-10-05',status:'不合格',life_diff:33},
      
     ];

    return <>
         <ProCard title='调校单' style={{height:700}}
         >
             <ProTable<DataType>
                search={false}
                options={false}
                columns={columns}
                dataSource={tdata}

                />
         </ProCard>
    </>;
};

export default App;